Skip to content

ci(workflows): migrate ci.yml to dorny/paths-filter detect job (#413) - #460

Closed
yoshi280 wants to merge 1 commit into
mainfrom
ci/issue-413-paths-filter-migration
Closed

ci(workflows): migrate ci.yml to dorny/paths-filter detect job (#413)#460
yoshi280 wants to merge 1 commit into
mainfrom
ci/issue-413-paths-filter-migration

Conversation

@yoshi280

@yoshi280 yoshi280 commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Re-open of #442 (auto-closed during a rebase attempt that hit a real merge conflict in .github/workflows/ci.yml; the branch was force-pushed to main's HEAD, then restored to its original commit 60387b3). The original PR could not be reopened via API.

Refers #413. The diff is the original single signed commit. Author should resolve the merge conflict in ci.yml against current main (edge-rerank ship modified overlapping region) before this can be merged.

Summary by Sourcery

CI:

  • Introduce a dorny/paths-filter-based detect job to determine when Python-related changes require running pytest, replacing the previous paths-ignore-based triggering logic.

… detect job (#413)

paths-ignore made `pytest 3.12/3.13` register as `expected` (not
satisfied) on docs-only PRs, blocking merge under branch protection
that requires those checks. Surfaced concretely by #426 where the
README v1.7-row update could not merge despite being approved and
non-Python.

Replace with the pattern documented in the prior TODO comment:
workflow runs on every PR; a detect job uses dorny/paths-filter to
classify whether the diff touches Python source / tests / deps; the
pytest job gates on `if: needs.detect.outputs.python == 'true'`.
Skipped jobs register as `success` to branch protection — gating the
work, not the registration.

dorny/paths-filter pinned at v3.0.2 SHA per repo SHA-pin convention
(harden-runner / setup-uv pinned similarly upstream).
@sourcery-ai

sourcery-ai Bot commented May 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

Migrates the CI workflow from using pull_request.paths-ignore to a dedicated detection job using dorny/paths-filter, so the CI workflow always runs and pytest is conditionally skipped via an if-gated job instead of being unregistered for docs-only changes.

Sequence diagram for pull request triggering detect and conditionally running pytest

sequenceDiagram
  actor Developer
  participant GitHub
  participant CI_Workflow
  participant Job_detect
  participant Paths_filter
  participant Job_pytest

  Developer->>GitHub: Open or update pull_request targeting main
  GitHub-->>CI_Workflow: Trigger CI workflow (no paths-ignore)

  CI_Workflow->>Job_detect: Start detect job
  Job_detect->>Paths_filter: Run dorny/paths-filter with python filters
  Paths_filter-->>Job_detect: outputs.python (true or false)
  Job_detect-->>CI_Workflow: Job outputs python = steps.filter.outputs.python

  CI_Workflow->>Job_pytest: Evaluate needs.detect.outputs.python
  alt Changes touch Python src/tests/deps
    Job_pytest-->>CI_Workflow: Condition true, run pytest job
  else Docs-only or non-Python changes
    Job_pytest-->>CI_Workflow: Condition false, job skipped (reported as skipped)
  end

  CI_Workflow-->>GitHub: Report status for detect and pytest checks
Loading

File-Level Changes

Change Details Files
Introduce a detect job using dorny/paths-filter and gate the pytest job on its output so pytest is skipped for non-Python changes while the CI workflow and check always register on PRs.
  • Remove pull_request.paths-ignore configuration so the CI workflow triggers on every PR to main
  • Add a detect job that checks out the repo, runs step-security/harden-runner, and executes dorny/paths-filter to determine whether Python-related files have changed
  • Define a python filter in dorny/paths-filter that matches src, tests, key dependency files, and the CI workflow itself, and expose its result as a job output
  • Update the pytest job to depend on the detect job and wrap it in an if condition that runs pytest only when the python filter output is true
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@yoshi280 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 27 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 62ed6703-eee1-41df-942d-1480c58fa608

📥 Commits

Reviewing files that changed from the base of the PR and between da6bfaa and 60387b3.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/issue-413-paths-filter-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="27-28" />
<code_context>
 jobs:
+  detect:
+    runs-on: ubuntu-latest
+    outputs:
+      python: ${{ steps.filter.outputs.python }}
+    steps:
+      - uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Guard against missing or malformed `paths-filter` output to avoid surprising job skips.

This relies on `steps.filter.outputs.python` always being set to `'true'` or `'false'`. If the `dorny/paths-filter` step is renamed, skipped, or fails, `needs.detect.outputs.python` becomes empty and `pytest` will never run. Consider normalizing the value through an intermediate step/job-level output that defaults to `'true'` when unset, so misconfigurations still run pytest rather than silently skipping it.

Suggested implementation:

```
  detect:
    runs-on: ubuntu-latest
    outputs:
      python: ${{ steps.normalize-python.outputs.python }}

```

```
      - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
        id: filter
        with:
          filters: |
            python:
              - 'src/**'
              - 'tests/**'
      - name: Normalize python filter output
        id: normalize-python
        env:
          PYTHON_MATCH: ${{ steps.filter.outputs.python }}
        run: |
          if [ "${PYTHON_MATCH}" = "true" ] || [ "${PYTHON_MATCH}" = "false" ]; then
            echo "python=${PYTHON_MATCH}" >> "$GITHUB_OUTPUT"
          else
            # Default to true if the filter output is missing or malformed
            echo "python=true" >> "$GITHUB_OUTPUT"
          fi

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/ci.yml
Comment on lines +27 to +28
outputs:
python: ${{ steps.filter.outputs.python }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Guard against missing or malformed paths-filter output to avoid surprising job skips.

This relies on steps.filter.outputs.python always being set to 'true' or 'false'. If the dorny/paths-filter step is renamed, skipped, or fails, needs.detect.outputs.python becomes empty and pytest will never run. Consider normalizing the value through an intermediate step/job-level output that defaults to 'true' when unset, so misconfigurations still run pytest rather than silently skipping it.

Suggested implementation:

  detect:
    runs-on: ubuntu-latest
    outputs:
      python: ${{ steps.normalize-python.outputs.python }}

      - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
        id: filter
        with:
          filters: |
            python:
              - 'src/**'
              - 'tests/**'
      - name: Normalize python filter output
        id: normalize-python
        env:
          PYTHON_MATCH: ${{ steps.filter.outputs.python }}
        run: |
          if [ "${PYTHON_MATCH}" = "true" ] || [ "${PYTHON_MATCH}" = "false" ]; then
            echo "python=${PYTHON_MATCH}" >> "$GITHUB_OUTPUT"
          else
            # Default to true if the filter output is missing or malformed
            echo "python=true" >> "$GITHUB_OUTPUT"
          fi

@yoshi280

yoshi280 commented May 8, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #446, which shipped the dorny/paths-filter migration to ci.yml in v1.7.0 with a different (more compact, inline) implementation. Confirmed by reading current main's .github/workflows/ci.yml lines 6-33: the workflow already runs on every PR with an in-job dorny/paths-filter@v3 step, and pytest gates on the python-changed output. Same goal, already achieved.

Closing rather than rebasing to avoid the duplicate-implementation churn.

@yoshi280 yoshi280 closed this May 8, 2026
@yoshi280
yoshi280 deleted the ci/issue-413-paths-filter-migration branch May 8, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attn:merge-conflict PR branch needs rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants